import Vue from 'vue'
import Vuex from 'vuex'
import permission from './modules/permission_modules.js';

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    crumbList:'',//面包屑导航
    get token(){
      return localStorage.getItem('token')
    },
    set token(value){
      localStorage.setItem('token',value)
    },
    get userInfo(){
      return JSON.parse(localStorage.getItem('userInfo'))
    },
    set userInfo(value){
      localStorage.setItem('userInfo',JSON.stringify(value))
    }
  },
  mutations: {
    LOIGIN_IN(state,playload){// 登录成功设置token
      state.token=playload.token
      state.userInfo=playload
    },
    LOGIN_OUT(state){// 退出登录
      state.token=''
      state.userInfo=''
    },
    setCrumbList(state, list) {//面包屑导航
      state.crumbList = list
    }
  },
  actions: {
  },
  modules: {
    permission//权限
  }
})
